package org.come.Jpanel;

import com.gl.util.Xy2Util;
import com.tool.imagemonitor.FightingMonitor;
import com.tool.role.RoleData;
import com.tool.role.SkillUtil;
import com.tool.tcpimg.UIUtils;
import come.tool.Fighting.TypeState;

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.image.ImageObserver;
import java.util.ArrayList;
import java.util.List;

import javax.swing.*;

import org.come.Frame.*;
import org.come.bean.ImgZoom;
import org.come.bean.LoginResult;
import org.come.bean.Skill;
import org.come.entity.RoleSummoning;
import org.come.gltools.RendererTools;
import org.come.until.AnalysisString;
import org.come.until.CutButtonImage;
import org.come.until.FormsManagement;
import org.come.until.MessagrFlagUntil;
import org.come.until.ScrenceUntil;
import org.come.until.UserMessUntil;

import com.gl.util.Xy2Util;
import com.tool.imagemonitor.FightingMonitor;
import com.tool.role.RoleData;
import com.tool.role.SkillUtil;
import com.tool.tcpimg.UIUtils;

import come.tool.Fighting.TypeState;

public class SkillMsgJpaenl extends JPanel {
    private SkillMsgJpaenl.SkillMsg[] skillMsgs;
    private JLabel mp;
    private JLabel[] gans;
    int type;
    private ImgZoom imgZoom;
    private ImgZoom imgZoomS;
    Color color;
    static String[] vs;
    String[] vr;
    int size;
    int bh;
    int bw;
    int bh1;
    int bw1;

    public SkillMsgJpaenl() {
        this.skillMsgs = new SkillMsgJpaenl.SkillMsg[10];
        this.gans = new JLabel[15];
        this.type = 0;
        this.imgZoom = CutButtonImage.cuts("inkImg/old/7/xy_1.png", 14, 7, true);
        this.imgZoomS = CutButtonImage.cuts("inkImg/old/7/ss853.png", 14, 7, true);
        this.color = Color.decode("0xc0ac56");
        this.vr = new String[]{"冥", "蛊", "忘"};
        this.size = 0;
        this.setPreferredSize(new Dimension(420, 350));
        this.setLayout(null);
        this.setBackground(Color.BLACK);
        this.setBackground(new Color(0, 0, 0, 0));
        (this.mp = new JLabel()).setVisible(false);
        this.add((Component) this.mp);
        int i = 0;
        while (i < this.gans.length) {
            this.gans[i] = new JLabel();
            final int w = i % 3;
            final int h = i / 3;
            this.gans[i].setBounds(40 + 130 * w, 10 + 155 * h, 13, 13);
            this.add((Component) this.gans[i]);
            ++i;
        }
        i = 0;
        while (i < this.skillMsgs.length) {
            this.skillMsgs[i] = new SkillMsgJpaenl.SkillMsg();
            final int w = i % 3;
            final int h = i / 3;
            this.skillMsgs[i].setBounds(28 + 140 * w, 10 + 155 * h, 110, 130);
            this.add((Component) this.skillMsgs[i]);
            ++i;
        }
    }

    public void showSkill(final List<TypeState> list, final int type) {
        this.type = type;
        int i = 0;
        while (i < this.skillMsgs.length) {
            final SkillMsgJpaenl.SkillMsg skillMsg = this.skillMsgs[i];
            skillMsg.skillModel.clear();
            skillMsg.imgs.clear();
            skillMsg.typeStates.clear();
            ++i;
        }
        if (type == 1) {
            i = 0;
            while (i < this.skillMsgs.length) {//修复召唤兽主动技能只能显示5个的问题  下面还有一个
             //   this.skillMsgs[i] = new SkillMsgJpaenl.SkillMsg();
                final int w = i % 3;
                final int h = i / 3;
                this.skillMsgs[i].setBounds(28 + 140 * w, 10 + 155 * h, 110, 130);
           //     this.add((Component) this.skillMsgs[i]);
                ++i;
            }
            final List<String> list2 = new ArrayList();
            int j = 0;
            while (j < list.size()) {
                if (((TypeState) list.get(j)).getState() == 0) {
                    final Skill skill = UserMessUntil.getskill1(((TypeState) list.get(j)).getType());
                    if (skill == null) {
                        return;
                    } else {
                        final int id = Integer.parseInt(skill.getSkillid());
                        final double mv = Double.parseDouble(skill.getDielectric());
                        final String skilltype = SkillUtil.getSkillDoor(((TypeState) list.get(j)).getType());
                        int p = 5;
                        if (skilltype != null) {
                            boolean l = true;
                            int k = list2.size() - 1;
                            while (k >= 0) {
                                if (((String) list2.get(k)).equals(skilltype)) {
                                    p = k;
                                    l = false;
                                    break;
                                } else {
                                    --k;
                                }
                            }
                            if (l && list2.size() <= 3) {
                                list2.add(skilltype);
                                p = list2.size() - 1;
                            }
                        }
                        if ("清心静气".equals(((TypeState) list.get(j)).getType()) || "以静制动".equals(((TypeState) list.get(j)).getType()) || "利刃加身".equals(((TypeState) list.get(j)).getType()) || "积羽沉舟".equals(((TypeState) list.get(j)).getType()) || "神不守舍".equals(((TypeState) list.get(j)).getType()) || "扑朔迷离".equals(((TypeState) list.get(j)).getType()) || "神力加身".equals(((TypeState) list.get(j)).getType()) || "云飞烟灭".equals(((TypeState) list.get(j)).getType()) || "凝神一击".equals(((TypeState) list.get(j)).getType()) || "一气呵成".equals(((TypeState) list.get(j)).getType()) || "无坚不摧".equals(((TypeState) list.get(j)).getType()) || "韬光养晦".equals(((TypeState) list.get(j)).getType()) || "气吞山河".equals(((TypeState) list.get(j)).getType()) || "催筋断骨".equals(((TypeState) list.get(j)).getType()) || "幻影迷踪".equals(((TypeState) list.get(j)).getType()) || "心无旁骛".equals(((TypeState) list.get(j)).getType()) || "力挽狂澜".equals(((TypeState) list.get(j)).getType()) || "披荆斩棘".equals(((TypeState) list.get(j)).getType()) || "兽魂俯首".equals(((TypeState) list.get(j)).getType()) || "困兽之斗".equals(((TypeState) list.get(j)).getType()) || "刚柔兼备".equals(((TypeState) list.get(j)).getType()) || "妙法莲华".equals(((TypeState) list.get(j)).getType()) || "势如破竹".equals(((TypeState) list.get(j)).getType()) || "暴虎冯河".equals(((TypeState) list.get(j)).getType()) || "法魂护体".equals(((TypeState) list.get(j)).getType()) || "血蛊佑身".equals(((TypeState) list.get(j)).getType()) || "气聚神凝".equals(((TypeState) list.get(j)).getType()) || "明镜止水".equals(((TypeState) list.get(j)).getType()) || "失魂落魄".equals(((TypeState) list.get(j)).getType()) || "人鬼殊途".equals(((TypeState) list.get(j)).getType()) || "鱼龙潜跃".equals(((TypeState) list.get(j)).getType()) || "虎踞龙盘".equals(((TypeState) list.get(j)).getType()) || "行气如虹".equals(((TypeState) list.get(j)).getType()) || "浩气凌云".equals(((TypeState) list.get(j)).getType()) || "神龙摆尾".equals(((TypeState) list.get(j)).getType()) || "积健为雄".equals(((TypeState) list.get(j)).getType())) {
                            p = 3;
                        }
                        this.skillMsgs[p].addskill((TypeState) list.get(j));
                    }
                }
                ++j;
            }
            j = 0;
            while (j < 3) {
                if (j < list2.size()) {
                    this.skillMsgs[j].vs = new String[]{(String) list2.get(j)};
                } else {
                    this.skillMsgs[j].vs = new String[]{""};
                }
                ++j;
            }
            this.size = 6;
            this.bh = 350;
            this.bw = 420;
            SkillMsgJframe.getSkillMsgJframe().setBounds(ScrenceUntil.Screen_x / 2 - 200, 208, this.bw, this.bh);

            this.imgZoomS.setMiddlew(this.bw - 2 * this.imgZoomS.getEdgew());
            this.imgZoomS.setMiddleh(this.bh - 2 * this.imgZoomS.getEdgeh());

            this.skillMsgs[3].vs = new String[]{"法", "门"};
            this.skillMsgs[4].vs = new String[]{"天", "赋"};
            this.skillMsgs[5].vs = new String[]{"其", "他"};
        } else {
            if (type == 2) {
                i = 0;
                while (i < this.skillMsgs.length) {//修复召唤兽主动技能只能显示6个的问题
                    //   this.skillMsgs[i] = new SkillMsgJpaenl.SkillMsg();
                    final int w = i % 3;
                    final int h = i / 3;
                    this.skillMsgs[i].setBounds(28 + 140 * w, 10 + 155 * h, 110, 300);
                    //     this.add((Component) this.skillMsgs[i]);
                    ++i;
                }
                i = 0;

                while (i < list.size()) {
                    if (list.get(i).getState() == 0) {
                        if ("大闹天宫".equals(list.get(i).getType()) || "遮天蔽日".equals(list.get(i).getType()) ||
                                "妙手空空".equals(list.get(i).getType()) || "万剑归宗".equals(list.get(i).getType()) || "偷梁换柱".equals(list.get(i).getType())) {
                            final int pp = 1;
                            this.skillMsgs[pp].addskill((TypeState) list.get(i));
                        }
                        if (((TypeState) list.get(i)).getType().equals("雷霆霹雳") || ((TypeState) list.get(i)).getType().equals("日照光华") ||((TypeState) list.get(i)).getType().equals("通灵之术") ||
                                ((TypeState) list.get(i)).getType().equals("雷神怒击") || ((TypeState) list.get(i)).getType().equals("电闪雷鸣") ||((TypeState) list.get(i)).getType().equals("白虎啸天击") ||
                                ((TypeState) list.get(i)).getType().equals("飞砂走石") || ((TypeState) list.get(i)).getType().equals("乘风破浪") ||
                                ((TypeState) list.get(i)).getType().equals("太乙生风") || ((TypeState) list.get(i)).getType().equals("风雷涌动") ||
                                ((TypeState) list.get(i)).getType().equals("龙卷雨击") || ((TypeState) list.get(i)).getType().equals("龙腾水溅") ||
                                ((TypeState) list.get(i)).getType().equals("龙啸九天") || ((TypeState) list.get(i)).getType().equals("蛟龙出海") ||
                                ((TypeState) list.get(i)).getType().equals("地狱烈火") || ((TypeState) list.get(i)).getType().equals("天雷怒火") ||
                                ((TypeState) list.get(i)).getType().equals("三味真火") || ((TypeState) list.get(i)).getType().equals("烈火骄阳") ||
                                ((TypeState) list.get(i)).getType().equals("反间之计") || ((TypeState) list.get(i)).getType().equals("情真意切") ||
                                ((TypeState) list.get(i)).getType().equals("谗言相加") || ((TypeState) list.get(i)).getType().equals("借刀杀人") ||
                                ((TypeState) list.get(i)).getType().equals("作茧自缚") || ((TypeState) list.get(i)).getType().equals("金蛇缠丝") ||
                                ((TypeState) list.get(i)).getType().equals("天罗地网") || ((TypeState) list.get(i)).getType().equals("作壁上观") ||
                                ((TypeState) list.get(i)).getType().equals("催眠咒") || ((TypeState) list.get(i)).getType().equals("瞌睡咒") ||
                                ((TypeState) list.get(i)).getType().equals("离魂咒") || ((TypeState) list.get(i)).getType().equals("迷魂醉") ||
                                ((TypeState) list.get(i)).getType().equals("蛇蝎美人") || ((TypeState) list.get(i)).getType().equals("追魂迷香") ||
                                ((TypeState) list.get(i)).getType().equals("断肠烈散") || ((TypeState) list.get(i)).getType().equals("鹤顶红粉") ||
                                ((TypeState) list.get(i)).getType().equals("夺命勾魂") || ((TypeState) list.get(i)).getType().equals("追神摄魄") ||
                                ((TypeState) list.get(i)).getType().equals("魔音摄心") || ((TypeState) list.get(i)).getType().equals("销魂蚀骨") ||
                                ((TypeState) list.get(i)).getType().equals("妖之魔力") || ((TypeState) list.get(i)).getType().equals("力神复苏") ||
                                ((TypeState) list.get(i)).getType().equals("狮王之怒") || ((TypeState) list.get(i)).getType().equals("兽王神力") ||
                                ((TypeState) list.get(i)).getType().equals("魔之飞步") || ((TypeState) list.get(i)).getType().equals("急速之魔") ||
                                ((TypeState) list.get(i)).getType().equals("魔神飞舞") || ((TypeState) list.get(i)).getType().equals("天外飞魔") ||
                                ((TypeState) list.get(i)).getType().equals("红袖添香") || ((TypeState) list.get(i)).getType().equals("莲步轻舞") ||
                                ((TypeState) list.get(i)).getType().equals("楚楚可怜") || ((TypeState) list.get(i)).getType().equals("魔神护体") ||
                                ((TypeState) list.get(i)).getType().equals("幽冥鬼火") || ((TypeState) list.get(i)).getType().equals("火影迷踪") ||
                                ((TypeState) list.get(i)).getType().equals("冥烟销骨") || ((TypeState) list.get(i)).getType().equals("落日熔金") ||
                                ((TypeState) list.get(i)).getType().equals("吸血水蛭") || ((TypeState) list.get(i)).getType().equals("六翅毒蝉") ||
                                ((TypeState) list.get(i)).getType().equals("啮骨抽髓") || ((TypeState) list.get(i)).getType().equals("血煞之蛊") ||
                                ((TypeState) list.get(i)).getType().equals("麻沸散") || ((TypeState) list.get(i)).getType().equals("鬼失惊") ||
                                ((TypeState) list.get(i)).getType().equals("乱魂钉") || ((TypeState) list.get(i)).getType().equals("失心疯") ||
                                ((TypeState) list.get(i)).getType().equals("幽怜魅影") || ((TypeState) list.get(i)).getType().equals("醉生梦死") ||
                                ((TypeState) list.get(i)).getType().equals("一曲销魂") || ((TypeState) list.get(i)).getType().equals("秦丝冰雾") ||
                                ((TypeState) list.get(i)).getType().equals("失心狂乱") || ((TypeState) list.get(i)).getType().equals("四面楚歌") ||
                                ((TypeState) list.get(i)).getType().equals("百日眠") || ((TypeState) list.get(i)).getType().equals("万毒攻心") ||
                                ((TypeState) list.get(i)).getType().equals("阎罗追命") || ((TypeState) list.get(i)).getType().equals("魔神附身") ||
                                ((TypeState) list.get(i)).getType().equals("含情脉脉") || ((TypeState) list.get(i)).getType().equals("乾坤借速") ||
                                ((TypeState) list.get(i)).getType().equals("袖里乾坤") || ((TypeState) list.get(i)).getType().equals("天诛地灭") ||
                                ((TypeState) list.get(i)).getType().equals("九龙冰封") || ((TypeState) list.get(i)).getType().equals("九阴纯火") ||
                                ((TypeState) list.get(i)).getType().equals("血海深仇") || ((TypeState) list.get(i)).getType().equals("吸星大法") ||
                                ((TypeState) list.get(i)).getType().equals("孟婆汤") || ((TypeState) list.get(i)).getType().equals("倩女幽魂") ||
                                ((TypeState) list.get(i)).getType().equals("震天动地") || ((TypeState) list.get(i)).getType().equals("沧海横流") ||
                                ((TypeState) list.get(i)).getType().equals("泽被万物") || ((TypeState) list.get(i)).getType().equals("飞举九天") ||
                                ((TypeState) list.get(i)).getType().equals("分光化影") || ((TypeState) list.get(i)).getType().equals("天魔解体") ||
                                ((TypeState) list.get(i)).getType().equals("小楼夜哭") || ((TypeState) list.get(i)).getType().equals("青面獠牙") ||
                                ((TypeState) list.get(i)).getType().equals("炊金馔玉") || ((TypeState) list.get(i)).getType().equals("枯木逢春") ||
                                ((TypeState) list.get(i)).getType().equals("西天净土") || ((TypeState) list.get(i)).getType().equals("如人饮水") ||
                                ((TypeState) list.get(i)).getType().equals("风火燎原") || ((TypeState) list.get(i)).getType().equals("万籁俱寂") ||
                                ((TypeState) list.get(i)).getType().equals("兵临城下") || ((TypeState) list.get(i)).getType().equals("妙手回春") ||
                                ((TypeState) list.get(i)).getType().equals("春意盎然") || ((TypeState) list.get(i)).getType().equals("舍身取义") ||
                                ((TypeState) list.get(i)).getType().equals("绝境逢生") || ((TypeState) list.get(i)).getType().equals("子虚乌有") ||
                                ((TypeState) list.get(i)).getType().equals("春回大地") || ((TypeState) list.get(i)).getType().equals("春暖花开") ||
                                ((TypeState) list.get(i)).getType().equals("夺魂索命") || ((TypeState) list.get(i)).getType().equals("五蕴皆空") ||
                                ((TypeState) list.get(i)).getType().equals("瞒天过海") || ((TypeState) list.get(i)).getType().equals("泽披天下") ||
                                ((TypeState) list.get(i)).getType().equals("慧眼菩提") || ((TypeState) list.get(i)).getType().equals("醍醐灌顶") ||
                                ((TypeState) list.get(i)).getType().equals("红衰翠减") || ((TypeState) list.get(i)).getType().equals("此恨绵绵") ||
                                ((TypeState) list.get(i)).getType().equals("移花接木") || ((TypeState) list.get(i)).getType().equals("神迟魂钝") ||
                                ((TypeState) list.get(i)).getType().equals("梵音初晓") || ((TypeState) list.get(i)).getType().equals("防不慎防") ||
                                ((TypeState) list.get(i)).getType().equals("万剑穿心") || ((TypeState) list.get(i)).getType().equals("困世法笼") ||
                                ((TypeState) list.get(i)).getType().equals("直捣黄龙") || ((TypeState) list.get(i)).getType().equals("倒转乾坤") ||
                                ((TypeState) list.get(i)).getType().equals("雷罚") || ((TypeState) list.get(i)).getType().equals("神罚") ||
                                ((TypeState) list.get(i)).getType().equals("藏锋蓄势") || ((TypeState) list.get(i)).getType().equals("魔尽佛生") ||
                                ((TypeState) list.get(i)).getType().equals("炎阳神罚") || ((TypeState) list.get(i)).getType().equals("天籁梵音") ||
                                ((TypeState) list.get(i)).getType().equals("气化三清") || ((TypeState) list.get(i)).getType().equals("雪上加霜") ||((TypeState) list.get(i)).getType().equals("流连忘返")) {
                            final int pp = 0;
                            this.skillMsgs[pp].addskill((TypeState) list.get(i));
                        }
                    }
                    ++i;
                }
                i = 0;
                while (i < list.size()) {
                    if (((TypeState) list.get(i)).getState() != 0) {
                        this.skillMsgs[1].skillModel.addElement(((TypeState) list.get(i)).getType());
                        this.skillMsgs[1].typeStates.add(list.get(i));
                    }
                    ++i;
                }
                this.size = 10;
                this.bh = 290;
                this.bw = 290;
                this.imgZoomS.setMiddlew(this.bw - 2 * this.imgZoomS.getEdgew());
                this.imgZoomS.setMiddleh(this.bh - 2 * this.imgZoomS.getEdgeh());

                SkillMsgJframe.getSkillMsgJframe().setBounds(ScrenceUntil.Screen_x / 2 - 100, 213, this.bw, this.bh);
                this.skillMsgs[0].vs = new String[]{"召", "唤", "兽"};
                this.skillMsgs[1].vs = new String[]{"其", "他"};
                this.skillMsgs[2].vs = new String[]{"", ""};
                this.skillMsgs[3].vs = new String[]{"", ""};
                this.skillMsgs[4].vs = new String[]{"", ""};
                this.skillMsgs[5].vs = new String[]{"", ""};
            }
        }
        FormsManagement.showForm(34);
    }

    @Override
    protected void paintComponent(final Graphics g) {
        super.paintComponent(g);
        final Graphics2D g2d = (Graphics2D) g;
        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        g2d.setComposite((Composite) AlphaComposite.getInstance(3, 0.999f));
        g2d.setFont(UIUtils.TEXT_FONT22);
        g2d.setColor(new Color(203, 181, 91));

        this.imgZoomS.draw3((Graphics) g2d);

        int i = 0;
        while (i < this.size) {
            final SkillMsgJpaenl.SkillMsg skillMsg = this.skillMsgs[i];
            final int w = i % 3;
            final int h = i / 3;
            int j = 0;
            while (j < skillMsg.vs.length) {
                g2d.drawString(skillMsg.vs[j], 5 + w * 130, 26 + h * 160 + j * 20);
                g2d.drawString(skillMsg.vs[j], 6 + w * 130, 26 + h * 160 + j * 20);
                ++j;
            }
            j = skillMsg.imgs.size() - 1;
            while (j >= 0) {
                g2d.drawImage((Image) skillMsg.imgs.get(j), 30 + 140 * w, 10 + 170 * h + j * 20, 20, 20, (ImageObserver) this);
                --j;
            }
            ++i;
        }
    }

    public JLabel getMp() {
        return this.mp;
    }

    public void setMp(final JLabel mp) {
        this.mp = mp;
    }

    public int getType() {
        return this.type;
    }

    public void setType(final int type) {
        this.type = type;
    }

    static {
        vs = new String[]{"法", "门", "天", "赋", "其", "他", "召", "唤", "兽"};
    }

    public class SkillMsg extends JList<String> {
        public String[] vs;
        public String[] name;
        public List<Image> imgs;
        public List<TypeState> typeStates;
        public DefaultListModel<String> skillModel;
        public SkillMsgJpaenl.SkillMsg SkillMsg;
        public ImageIcon icons;
        public ImageIcon iconh;

        public SkillMsg() {
            this.vs = new String[]{"测", "试"};
            this.imgs = new ArrayList();
            this.typeStates = new ArrayList();
            this.SkillMsg = this;
            this.skillModel = new DefaultListModel();
            this.setSelectionForeground(Color.WHITE);
            this.setOpaque(false);
            this.setForeground(Color.white);
            this.setBackground(new Color(0, 0, 0, 0));
            this.setModel(this.skillModel);
            this.setFont(UIUtils.TEXT_MSG17);
            this.addMouseMotionListener(new MouseMotionListener() {
                @Override
                public void mouseMoved(final MouseEvent e) {
                    if (e.getY() / 24 < SkillMsgJpaenl.SkillMsg.this.SkillMsg.getModel().getSize()) {
                        SkillMsgJpaenl.SkillMsg.this.SkillMsg.setSelectedIndex((e.getY() - 1) / 24);
                        final Skill skill = UserMessUntil.getskill1((String) SkillMsgJpaenl.SkillMsg.this.skillModel.get((e.getY() - 1) / 24));
                        if (skill == null) {
                            return;
                        } else {
                            final int id = Integer.parseInt(skill.getSkillid());
                            final double mv = Double.parseDouble(skill.getDielectric());
                            final int lvl = RoleData.getRoleData().getLoginResult().getGrade().intValue();
                            final int lvltrue = AnalysisString.lvltrue(lvl);
                            final int grade = AnalysisString.lvlint(lvl);
                            if (SkillMsgJpaenl.this.type == 1 && id >= 1001 && id <= 1100) {
                                final LoginResult loginResult = RoleData.getRoleData().getLoginResult();
                                SkillMsgJpaenl.this.mp.setForeground(UIUtils.COLOR_HURTB3);
                                SkillMsgJpaenl.this.mp.setBackground(new Color(0, 0, 0, 0));
                                SkillMsgJpaenl.this.mp.setBounds(8, 6, 300, 30);
                                SkillMsgJpaenl.this.mp.setFont(UIUtils.TEXT_FONT78);
                                SkillMsgJpaenl.this.mp.setText("消耗MP:" + (int) mv * 2 + ",当前MP:" + loginResult.getMp());
                                FormsManagement.showForm(631);
                                SkillMsgJframe1.getSkillMsgJframe1().setBounds(ScrenceUntil.Screen_x / 2 - 200, 160, SkillMsgJpaenl.this.bw, SkillMsgJpaenl.this.bh);
                                if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE1)) {
                                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE12);
                                }
                                MsgJframe.getJframe().getJapnel().SM(skill, (double) Xy2Util.getProficiency(lvltrue), grade);
                            }
                            if (SkillMsgJpaenl.this.type == 2) {
                                final RoleSummoning pet = UserMessUntil.getChosePetMes();
                                SkillMsgJpaenl.this.mp.setForeground(UIUtils.COLOR_HURTB3);
                                SkillMsgJpaenl.this.mp.setBackground(new Color(0, 0, 0, 0));
                                SkillMsgJpaenl.this.mp.setBounds(8, 5, 300, 30);
                                SkillMsgJpaenl.this.mp.setFont(UIUtils.TEXT_FONT78);
                                SkillMsgJpaenl.this.mp.setText("消耗MP:" + (int) mv + ",当前MP:" + pet.getBasismp());
                                FormsManagement.showForm(631);
                                SkillMsgJframe1.getSkillMsgJframe1().setBounds(ScrenceUntil.Screen_x / 2 - 100, 165, SkillMsgJpaenl.this.bw, SkillMsgJpaenl.this.bh);
                                if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE1)) {
                                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE12);
                                }
                                MsgJframe1.getJframe1().getJapnel1().smx(skill, (double) Xy2Util.getProficiency(lvltrue), grade);//召唤兽施法显示施法说明----小情调备注
                            }
                        }
                    } else {
                        SkillMsgJpaenl.SkillMsg.this.SkillMsg.clearSelection();
                        FormsManagement.HideForm(46);
                        FormsManagement.HideForm(667);
                    }
                }

                @Override
                public void mouseDragged(final MouseEvent e) {
                }
            });
            this.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseEntered(final MouseEvent e) {
                    SkillMsgJpaenl.SkillMsg.this.setSelectionBackground(new Color(122, 117, 112));
                }

                @Override
                public void mouseExited(final MouseEvent e) {
                    if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE12)) {
                        MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
                    }
                    SkillMsgJpaenl.SkillMsg.this.setSelectionBackground(new Color(0, 0, 0, 0));
                    FormsManagement.HideForm(46);
                    FormsManagement.HideForm(667);
                }

                @Override
                public void mousePressed(final MouseEvent e) {
                    final JList list = (JList) e.getSource();
                    if (list.locationToIndex(e.getPoint()) == -1 && !e.isShiftDown() && !this.isMenuShortcutKeyDown((InputEvent) e)) {
                        list.clearSelection();
                    }
                    FormsManagement.HideForm(46);
                    FormsManagement.HideForm(667);
                    FormsManagement.HideForm(631);
                    FormsManagement.HideForm(34);
                    if (list.getSelectedIndex() == -1) {
                        return;
                    } else {
                        if (e.getButton() == 1) {
                            try {
                                int tmp = 0;
                                final int[] index = SkillMsgJpaenl.SkillMsg.this.SkillMsg.getSelectedIndices();
                                int i = 0;
                                while (i < index.length) {
                                    tmp = index[i];
                                    ++i;
                                }
                                if (!"".equals((String) SkillMsgJpaenl.SkillMsg.this.skillModel.get(tmp))) {
                                    FightingMonitor.mousesname = (String) SkillMsgJpaenl.SkillMsg.this.skillModel.get(tmp);
                                    FightingMonitor.mousestate = 1;
                                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE8);
                                    ZhuFrame.getZhuJpanel().HideBeastBtn();
                                }
                            } catch (Exception ex) {
                            }
                        }
                        return;
                    }
                }

                private boolean isMenuShortcutKeyDown(final InputEvent event) {
                    return (event.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0x0;
                }
            });
            this.setCellRenderer(new DefaultListCellRenderer() {
                @Override
                public Component getListCellRendererComponent(final JList<?> list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
                    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                    if (SkillMsgJpaenl.SkillMsg.this.typeStates != null) {
                        int i = 0;
                        final int len = SkillMsgJpaenl.SkillMsg.this.typeStates.size();
                        while (i < len) {
                            if (((TypeState) SkillMsgJpaenl.SkillMsg.this.typeStates.get(i)).getState() == 2 && i == index) {
                                this.setForeground(Color.red);
                            }
                            ++i;
                        }
                    }
                    if (SkillMsgJpaenl.this.type == 2) {
                        final Skill skill = UserMessUntil.getskill1((String) SkillMsgJpaenl.SkillMsg.this.skillModel.get(index));
                        if (skill != null) {
                            final ImageIcon icon = new ImageIcon("inkImg/old/Skill/Skill2/petskill/" + skill.getSkillid() + ".png");
                            icon.setImage(icon.getImage().getScaledInstance(24, 24, 1));
                            this.setIcon((Icon) icon);
                        }
                    }
                    if (SkillMsgJpaenl.this.type == 1) {
                        final Skill skill = UserMessUntil.getskill1((String) SkillMsgJpaenl.SkillMsg.this.skillModel.get(index));
                        if (skill != null) {
                            final LoginResult loginResult = RoleData.getRoleData().getLoginResult();
                            final double mv = Double.parseDouble(skill.getDielectric());
                            if (loginResult.getMp().intValue() < (int) mv * 2) {
                                final ImageIcon icon2 = new ImageIcon("inkImg/old/Skill/Skill2/40/" + skill.getSkillid() + ".png");
                                icon2.setImage(icon2.getImage().getScaledInstance(24, 24, 1));
                                this.setIcon((Icon) icon2);
                                this.setForeground(Color.red);
                            }
                            if (loginResult.getMp().intValue() > (int) mv * 2) {
                                final ImageIcon icon2 = new ImageIcon("inkImg/old/Skill/Skill2/40/" + skill.getSkillid() + ".png");
                                icon2.setImage(icon2.getImage().getScaledInstance(24, 24, 1));
                                this.setIcon((Icon) icon2);
                            }
                        }
                    }
                    return this;
                }
            });
        }

        @Override
        public int locationToIndex(final Point location) {
            final int index = super.locationToIndex(location);
            if (index != -1 && !this.getCellBounds(index, index).contains(location)) {
                return -1;
            } else {
                return index;
            }
        }

        public void addskill(final TypeState typeState) {
            this.typeStates.add(typeState);
            this.skillModel.addElement(typeState.getType());
        }

        public String[] getVs() {
            return this.vs;
        }

        public void setVs(final String[] vs) {
            this.vs = vs;
        }

        public List<Image> getImgs() {
            return this.imgs;
        }

        public void setImgs(final List<Image> imgs) {
            this.imgs = imgs;
        }

        public List<TypeState> getTypeStates() {
            return this.typeStates;
        }

        public void setTypeStates(final List<TypeState> typeStates) {
            this.typeStates = typeStates;
        }

        public DefaultListModel<String> getSkillModel() {
            return this.skillModel;
        }

        public void setSkillModel(final DefaultListModel<String> skillModel) {
            this.skillModel = skillModel;
        }

        public SkillMsgJpaenl.SkillMsg getSkillMsg() {
            return this.SkillMsg;
        }

        public void setSkillMsg(final SkillMsgJpaenl.SkillMsg skillMsg) {
            this.SkillMsg = skillMsg;
        }

        public ImageIcon getIcons() {
            return this.icons;
        }

        public void setIcons(final ImageIcon icons) {
            this.icons = icons;
        }

        public ImageIcon getIconh() {
            return this.iconh;
        }

        public void setIconh(final ImageIcon iconh) {
            this.iconh = iconh;
        }
    }
}

//{
//	public class SkillMsg extends JList<String> {
//		public String[] vs = new String[] { "测", "试" };
//		public List<Image> imgs = new ArrayList<>();
//		public List<TypeState> typeStates = new ArrayList<>();// 放置法术状态
//		public DefaultListModel<String> skillModel;// 放置法术列表对象
//		public SkillMsg SkillMsg;
//
//		public SkillMsg() {
//			// TODO Auto-generated constructor stub
//			this.SkillMsg = this;
//			this.skillModel = new DefaultListModel<String>();
//			this.setSelectionBackground(new Color(33, 42, 52));
//			this.setSelectionForeground(Color.WHITE);
//			this.setOpaque(false);
//			this.setForeground(Color.white);
//			this.setBackground(new Color(0, 0, 0, 0));
//			this.setModel(skillModel);
//			this.setFont(UIUtils.TEXT_MSG);
//
//			this.addMouseMotionListener(new MouseMotionListener() {
//				@Override
//				public void mouseMoved(MouseEvent e) {
//					if (e.getY() / 20 < SkillMsg.getModel().getSize()) {
//						SkillMsg.setSelectedIndex((e.getY() - 1) / 20);
//
//						Skill skill = UserMessUntil.getskill1(skillModel.get((e.getY() - 1) / 20));
//						if (skill == null) {
//							return;
//						}
//
//						int lvl = RoleData.getRoleData().getLoginResult().getGrade();
//						int lvltrue = AnalysisString.lvltrue(lvl);
//						int grade = AnalysisString.lvlint(lvl);
//						MsgJframe.getJframe().getJapnel().SM(skill, Xy2Util.getProficiency(lvltrue), grade);
//
//					} else {
//						SkillMsg.clearSelection();
//						FormsManagement.HideForm(46);
//					}
//				}
//
//				@Override
//				public void mouseDragged(MouseEvent e) {
//					// TODO Auto-generated method stub
//
//				}
//			});
//			this.addMouseListener(new MouseAdapter() {
//				public void mouseEntered(MouseEvent e) {
//					MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
//				}
//				@Override
//				public void mouseExited(MouseEvent e) {
//					MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
//					FormsManagement.HideForm(46);
//				}
//
//
//				@Override
//				public void mousePressed(MouseEvent e) {
//					JList list = (JList) e.getSource();
//					if (list.locationToIndex(e.getPoint()) == -1 && !e.isShiftDown() && !isMenuShortcutKeyDown(e)) {
//						list.clearSelection();
//					}
//					FormsManagement.HideForm(46);
//					FormsManagement.HideForm(34);
//					if (list.getSelectedIndex() == -1) {
//						return;
//					}
//					if (e.getButton() == MouseEvent.BUTTON1) {
//						try {
//							int tmp = 0;
//							int[] index = SkillMsg.getSelectedIndices();
//							// index值，这些index值由一个int array返回.
//							for (int i = 0; i < index.length; i++) {
//								tmp = index[i];
//							}
//							if (!skillModel.get(tmp).equals("")) {
//								FightingMonitor.mousesname = skillModel.get(tmp);
//								FightingMonitor.mousestate = 1;
//								MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE8);
//								ZhuFrame.getZhuJpanel().HideBeastBtn();
//							}
//						} catch (Exception e2) {
//							// TODO: handle exception
//						}
//					}
//				}
//
//				private boolean isMenuShortcutKeyDown(InputEvent event) {
//					return (event.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0;
//				}
//			});
//			this.setCellRenderer(new DefaultListCellRenderer() {
//				@Override
//				public Component getListCellRendererComponent(JList<?> list, Object value, int index,
//															  boolean isSelected, boolean cellHasFocus) {
//					super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
//					if (typeStates != null) {
//						for (int i = 0, len = typeStates.size(); i < len; i++) {
//							if (typeStates.get(i).getState() == 2 && i == index) {
//								setForeground(Color.red);
//							}
//						}
//					}
//					return this;
//				}
//			});
//		}
//
//		@Override
//		public int locationToIndex(Point location) {
//			int index = super.locationToIndex(location);
//			if (index != -1 && !getCellBounds(index, index).contains(location)) {
//				return -1;
//			} else {
//				return index;
//			}
//		}
//
//		public void addskill(TypeState typeState) {
//			typeStates.add(typeState);
//			skillModel.addElement(typeState.getType());
//		}
//	}
//	// 鬼族的：冥 蛊 忘 魅 人族的：冰 睡 混 毒 仙：风 雷 水 火 魔族：慑 牛 速 盘
//	// 师 师 师
//	//
//	//
//	//
//	// 法 天 其
//	// 门 赋 他
//
//	// 召 其
//	// 唤 他
//	// 兽
//	private SkillMsg[] skillMsgs = new SkillMsg[6];
//
//	// 当前法力值
//	private JLabel mp;
//
//	public SkillMsgJpaenl() {
//		// TODO Auto-generated constructor stub
//		this.setPreferredSize(new Dimension(420, 350));
//		this.setLayout(null);
//		this.setBackground(Color.BLACK);
//		this.setBackground(new Color(0, 0, 0, 0));
//		this.mp = new JLabel();
//		this.add(mp);
//		for (int i = 0; i < skillMsgs.length; i++) {
//			skillMsgs[i] = new SkillMsg();
//			int w = i % 3;
//			int h = i / 3;
//			skillMsgs[i].setBounds(55 + 140 * w, 30 + 170 * h, 75, 170);
//			this.add(skillMsgs[i]);
//		}
//	}
//
//	// 初始化界面
//	public void showSkill(List<TypeState> list, int type) {
//		this.type = type;
//		for (int i = 0; i < skillMsgs.length; i++) {
//			SkillMsg skillMsg = skillMsgs[i];
//			skillMsg.skillModel.clear();
//			skillMsg.imgs.clear();
//			skillMsg.typeStates.clear();
//		}
//		if (type == 1) {
//			// 画出当前法力值
//			LoginResult loginResult = RoleData.getRoleData().getLoginResult();
//			this.mp.setForeground(UIUtils.COLOR_PERSONAL);
//			this.mp.setBackground(new Color(0, 0, 0, 0));
//			this.mp.setBounds(55, 0, 300, 30);
//			this.mp.setFont(UIUtils.TEXT_MSG);
//			this.mp.setText("当前法力值：" + loginResult.getMp()+"   "+"当前血量值：" + loginResult.getHp());
//
//
//			List<String> list2 = new ArrayList<>();
//			for (int i = 0; i < list.size(); i++) {
//				if (list.get(i).getState() != 0) {
//					continue;
//				}
//				String skilltype = SkillUtil.getSkillDoor(list.get(i).getType());
//				int p = 5;
//				if (skilltype != null) {
//					boolean l = true;
//					for (int j = list2.size() - 1; j >= 0; j--) {
//						if (list2.get(j).equals(skilltype)) {
//							p = j;
//							l = false;
//							break;
//						}
//					}
//					if (l && list2.size() <= 3) {
//						list2.add(skilltype);
//						p = list2.size() - 1;
//					}
//				}
//				//法门
//				if (list.get(i).getType().equals("清心静气")||list.get(i).getType().equals("以静制动")
//						||list.get(i).getType().equals("利刃加身")||list.get(i).getType().equals("积羽沉舟"	)
//						||list.get(i).getType().equals("神不守舍")||list.get(i).getType().equals( "扑朔迷离"	)
//						||list.get(i).getType().equals("神力加身")||list.get(i).getType().equals( "云飞烟灭")
//						||list.get(i).getType().equals("凝神一击")||list.get(i).getType().equals( "一气呵成")
//						||list.get(i).getType().equals("无坚不摧")||list.get(i).getType().equals("韬光养晦")
//						||list.get(i).getType().equals( "气吞山河")||list.get(i).getType().equals("催筋断骨")
//						||list.get(i).getType().equals("幻影迷踪")||list.get(i).getType().equals("心无旁骛")
//						||list.get(i).getType().equals("力挽狂澜")||list.get(i).getType().equals("披荆斩棘")
//						||list.get(i).getType().equals("兽魂俯首")||list.get(i).getType().equals("困兽之斗")
//						||list.get(i).getType().equals("刚柔兼备")||list.get(i).getType().equals("妙法莲华")
//						||list.get(i).getType().equals("势如破竹")||list.get(i).getType().equals("暴虎冯河")
//						||list.get(i).getType().equals("法魂护体")||list.get(i).getType().equals("血蛊佑身")
//						||list.get(i).getType().equals("气聚神凝")||list.get(i).getType().equals("明镜止水")
//						||list.get(i).getType().equals("失魂落魄")||list.get(i).getType().equals("人鬼殊途")
//						||list.get(i).getType().equals("鱼龙潜跃")||list.get(i).getType().equals("虎踞龙盘")
//						||list.get(i).getType().equals("行气如虹")||list.get(i).getType().equals("浩气凌云")
//						||list.get(i).getType().equals("神龙摆尾")||list.get(i).getType().equals("积健为雄")
//				) {
//					p=3;
//				}
//				skillMsgs[p].addskill(list.get(i));
//			}
//			for (int i = 0; i < 3; i++) {
//				if (i < list2.size()) {
//					skillMsgs[i].vs = new String[] { list2.get(i) };
//					if(skillMsgs[i].getModel()!=null) {
//						for(int j = 0; j<5;j++) {
//							int is = skillMsgs[i].getModel().getSize();
//							if(is>j) {
//								//战斗技能图标
//								if(UserMessUntil.getskill1(skillMsgs[i].getModel().getElementAt(j))!=null) {
//									ImageIcon jn = new ImageIcon("inkImg/old/skill/fighting-skill/"+UserMessUntil.getskill1(skillMsgs[i].getModel().getElementAt(j)).getSkillid()+".png");
//									skillMsgs[i].imgs.add(jn.getImage());
//								}
//							}
//						}
//					}
//				} else {
//					skillMsgs[i].vs = new String[] { "" };
//				}
//			}
//			size = 6;
//			bh = 350;
//			bw = 420;
//			SkillMsgJframe.getSkillMsgJframe().setBounds(ScrenceUntil.Screen_x - 520, 160, bw, bh);
//			imgZoom.setMiddlew(bw - 2 * imgZoom.getEdgew());
//			imgZoom.setMiddleh(bh - 2 * imgZoom.getEdgeh());
//			skillMsgs[3].vs = new String[] { "法", "门" };
//			skillMsgs[4].vs = new String[] { "天", "赋" };
//			skillMsgs[5].vs = new String[] { "其", "他" };
//
//
//
//			if(skillMsgs[5].getModel()!=null) {
//				for(int j = 0; j<5;j++) {
//					int is = skillMsgs[5].getModel().getSize();
//					if(is>j) {
//						//战斗技能图标
//						if(UserMessUntil.getskill1(skillMsgs[5].getModel().getElementAt(j))!=null) {
//							Skill skill = UserMessUntil.getskill1(skillMsgs[5].getModel().getElementAt(j));
//							ImageIcon jn = new ImageIcon("inkImg/old/skill/fighting-skill/"+skill.getSkillid()+".png");
//							skillMsgs[5].imgs.add(jn.getImage());
//						}
//					}
//				}
//			}
//		} else if (type == 2) {
//			RoleSummoning pet = UserMessUntil.getChosePetMes();
//			this.mp.setForeground(UIUtils.COLOR_PERSONAL);
//			this.mp.setBackground(new Color(0, 0, 0, 0));
//			this.mp.setBounds(55, 0, 300, 30);
//			this.mp.setFont(UIUtils.TEXT_MSG);
//			this.mp.setText("当前法力值：" + pet.getBasismp()+"   "+"当前血量值：" + pet.getBasishp());
//
//			size = 6;
//			bh = 290;
//			bw = 350;
//			imgZoom.setMiddlew(bw - 2 * imgZoom.getEdgew());
//			imgZoom.setMiddleh(bh - 2 * imgZoom.getEdgeh());
//			SkillMsgJframe.getSkillMsgJframe().setBounds(ScrenceUntil.Screen_x - 490, 160, bw, bh);
//			for (int i = 0; i < list.size(); i++) {
//				if (list.get(i).getState() == 0) {
//					skillMsgs[0].skillModel.addElement(list.get(i).getType());
//					skillMsgs[0].typeStates.add(list.get(i));
//					//战斗技能图标
//					int is = skillMsgs[0].getModel().getSize();
//					if(is>i) {
//						String s = skillMsgs[0].getModel().getElementAt(i);
//						if(UserMessUntil.getskill1(skillMsgs[0].getModel().getElementAt(i))!=null) {
//							Skill skill = UserMessUntil.getskill1(skillMsgs[0].getModel().getElementAt(i));
//							if(Integer.parseInt(skill.getSkillid())>=1001 && Integer.parseInt(skill.getSkillid())<=1100) {
//								ImageIcon jn = new ImageIcon("inkImg/old/skill/fighting-skill/"+skill.getSkillid()+".png");
//								skillMsgs[0].imgs.add(jn.getImage());
//							}else {
//								ImageIcon jn = new ImageIcon("inkImg/old/skill/fighting-skill/wxs_"+skill.getSkillid()+".png");
//								skillMsgs[0].imgs.add(jn.getImage());
//							}
//						}
//					}
//				}
//			}
//			skillMsgs[0].vs = new String[] { "召", "唤", "兽" };
//			skillMsgs[1].vs = new String[] { "其", "他" };
//			skillMsgs[2].vs = new String[] { "", "" };
//			skillMsgs[3].vs = new String[] { "", "" };
//			skillMsgs[4].vs = new String[] { "", "" };
//			skillMsgs[5].vs = new String[] { "", "" };
//		}
////		初始化技能分类
////		1001-1005 混 1006-1010 冰 1011-1015 睡 1016-1020 毒
////		1021-1025 慑 1026-1030 牛 1031-1035 盘 1036-1040 速
////		1041-1045 风 1046-1050 雷 1051-1055 水 1056-1060 火
////		1061-1065 冥 1066-1070 蛊 1071-1075 忘 1086-1080 魅
//		FormsManagement.showForm(34);
//	}
//
//	// 模式 1人 2召唤兽
//	int type = 0;
//	private ImgZoom imgZoom = CutButtonImage.cuts("inkImg/hongmu/2/tishikuang.png", 14, 7, true);
//	Color color = Color.decode("0xCCCC99");
//	static String[] vs = new String[] { "法", "门", "天", "赋", "其", "他", "召", "唤", "兽" };
//	// 鬼族的：冥 蛊 忘 魅 人族的：冰 睡 混 毒 仙：风 雷 水 火 魔族：慑 牛 速 盘
//	String[] vr = new String[] { "冥", "蛊", "忘" };
//	int size = 0;
//	int bh, bw;
//
//	@Override
//	protected void paintComponent(Graphics g) {
//		// TODO Auto-generated method stub
//		super.paintComponent(g);
////		if (icon==null)icon=new ImageIcon("inkImg/hongmu/2/tishikuang.png");
////		g.drawImage(icon.getImage(),0,0,100,350, this);
//
//		Graphics2D g2d = (Graphics2D) g;
//		g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//		g2d.setFont(UIUtils.TEXT_FONT22);
//		g2d.setColor(color);
//		imgZoom.draw(g2d);
//		for (int i = 0; i < size; i++) {
//			SkillMsg skillMsg = skillMsgs[i];
//			int w = i % 3;
//			int h = i / 3;
//			for (int j = 0; j < skillMsg.vs.length; j++) {
//				g2d.drawString(skillMsg.vs[j], 10 + w * 140, 47 + h * 155 + j * 20);
//			}
//			for (int j = skillMsg.imgs.size() - 1; j >= 0; j--) {
////				skillMsgs[i].setBounds(55+140*w, 10+170*h, 75, 170);
//				g2d.drawImage(skillMsg.imgs.get(j), 32 + 140 * w, 32 + 170 * h + j * 22, 18, 18, this);
//			}
//		}
//		g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//
//	}
//}
